#ifndef OBSTACLE__
#define OBSTACLE__

#include <vector>
#include "vec2d.h"
#include <algorithm>

class Obstacle {

public:
    Obstacle() = default;
    ~Obstacle() = default;
    void Convex(std::vector<double> x, std::vector<double> y);
    std::vector<Vec2d> Get_Result();
    void CounterclockwiseSortPoints(std::vector<Vec2d>& vPoints);
    void SetType(int x) {type_ = x;}
    void ThreepointsFormingCircle(double x1, double y1, double x2, double y2,
                                  double x3, double y3);
    void Circle2box(double R,double x,double y);
    // bool cmp2(Vec2d p1,Vec2d p2);

    std::vector<Vec2d> GetPoints() {return points_;}
    int GetType() {return type_;}
    double GetMaxX() {return max_x_;}
    double GetMaxY() {return max_y_;}
    double GetMinX() {return min_x_;}
    double GetMinY() {return min_y_;}

private:
    std::vector<Vec2d> points_;
    // 多边形点集
    std::vector<Vec2d> p_;
    size_t nums_ = 0;
    std::vector<double> x_;
    std::vector<double> y_;
    Vec2d base_;

    // 圆形点集
    Vec2d Centercir_;
    double R_ = 0.0;

    double max_x_ = 0.0;
    double max_y_ = 0.0;
    double min_x_ = 0.0;
    double min_y_ = 0.0;
    int type_ = 0; // 0是未设定 1是多边形 2是圆形
};



#endif //OBSTACLE__